

package com.hazelcast.client.impl.protocol.codec.custom;

import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.Generated;
import com.hazelcast.client.impl.protocol.codec.builtin.StringCodec;

import static com.hazelcast.client.impl.protocol.ClientMessage.BEGIN_FRAME;
import static com.hazelcast.client.impl.protocol.ClientMessage.END_FRAME;
import static com.hazelcast.client.impl.protocol.codec.builtin.CodecUtil.fastForwardToEndFrame;

@SuppressWarnings("unused")
@Generated("bd0b8674b66fc4ad66607dc5758815ce")
public final class AttributeConfigCodec {

    private AttributeConfigCodec() {
    }

    public static void encode(ClientMessage clientMessage, com.hazelcast.config.AttributeConfig attributeConfig) {
        clientMessage.add(BEGIN_FRAME.copy());

        StringCodec.encode(clientMessage, attributeConfig.getName());
        StringCodec.encode(clientMessage, attributeConfig.getExtractorClassName());

        clientMessage.add(END_FRAME.copy());
    }

    public static com.hazelcast.config.AttributeConfig decode(ClientMessage.ForwardFrameIterator iterator) {
        // begin frame
        iterator.next();

        java.lang.String name = StringCodec.decode(iterator);
        java.lang.String extractorClassName = StringCodec.decode(iterator);

        fastForwardToEndFrame(iterator);

        return new com.hazelcast.config.AttributeConfig(name, extractorClassName);
    }
}
